package cn.wellwan.mybatis.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

/**
 * creator: maokai
 * on: 2018/3/7
 * description:
 */
public class WellwanServiceProxy implements InvocationHandler {


    private Object target;

    public Object bind (Object object) {
        this.target = object;
        return Proxy.newProxyInstance(object.getClass().getClassLoader() , target.getClass().getInterfaces() , this);
    }

    @Override
    public Object invoke (Object proxy , Method method , Object[] args) throws Throwable {
        Object result = null;
        result = method.invoke(target , args);
        return result;
    }
}
